FROM ubuntu:18.04
MAINTAINER Lee <lcandzq@126.com>

RUN rm -rf /etc/apt/sources.list
COPY ./sources.list /etc/apt/sources.list

RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y nginx php-fpm php-curl php-mbstring\
                   php-mysqli php-gd php-json \
                   php-xml php-zip php-pear php-dev

RUN DEBIAN_FRONTEND=noninteractive pecl install redis

RUN DEBIAN_FRONTEND=noninteractive apt-get -y autoremove && apt-get clean \
    && apt-get autoclean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/www/html/* \

RUN rm -rf /etc/nginx/nginx.conf
COPY ./conf/nginx.conf /etc/nginx/nginx.conf

RUN rm -rf /etc/nginx/sites-available/default
COPY ./conf/default /etc/nginx/sites-available/default

RUN rm -rf /etc/php/7.2/fpm/php.ini
COPY ./conf/php.ini /etc/php/7.2/fpm/php.ini

# Add Scripts
ADD ./script/start.sh /start.sh
RUN chmod 755 /start.sh
#
EXPOSE 443 80

CMD ["/start.sh"]
#RUN service php7.2-fpm start
#RUN service nginx restart